// import purchase from "./modules/purchase";
// import sell from "./modules/sell";
// import stock from "./modules/stock";
// import finance from "./modules/finance";
// import component from "./modules/component";
// import main from "./modules/main";
// import bill from "./modules/bills";
// import header from "./modules/header";
// import fund from "./modules/fund";
// import transport from "./modules/transport";
// import centralized from "./modules/centralized";
// import workflow from "./modules/workflow";
// import rulesCenter from "./modules/rulesCenter";
// import systemSet from "./modules/systemSet";
// import business from "./modules/business";
// import setting from "./modules/setting";
// import digitizatieOperate from "./modules/digitizatieOperate";

// // 经理人工作台
// import businessWockbench from "./modules/businessWockbench";
// import managementWorkbench from "./modules/managementWorkbench";
// import riskManagement from "./modules/riskManagementWorkbench";
// import performance from "./modules/performance";
// import surveillance from "./modules/surveillance";
// import information from "./modules/information";
// import hanLongTerm from "./modules/hanLongTerm";
import layoutHeaderAside from "@/layout/index.js";
import authManage from './modules/authManage';

// //招商员工作台
// import merchants from "./modules/merchants";

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require("@/libs/util.import." + process.env.NODE_ENV);

export const dynamicRoutes = [
  authManage
  // home,
  // purchase,
  // sell,
  // stock,
  // finance,
  // component,
  // main,
  // bill,
  // header,
  // fund,
  // transport,
  // centralized,
  // workflow,
  // rulesCenter,
  // systemSet,
  // business,
  // setting,
  // digitizatieOperate,
  // // 经理人工作台
  // businessWockbench,
  // managementWorkbench,
  // riskManagement,
  // surveillance,
  // information,
  // hanLongTerm,
  // performance,
  // merchants
];

/**
 * 在主框架内显示
 */
const frameIn = [
  {
    path: "/",
    redirect: { name: "index" },
    component: layoutHeaderAside,
    children: [
      // 首页
      {
        path: "index",
        name: "index",
        meta: {
          title: "首页",
          auth: true,
          cache: true
        },
        component: _import("system/index")
      },
    ]
  },
  ...dynamicRoutes
];

/**
 * 在主框架之外显示
 */
const frameOut = [
  // 登录
  {
    path: "/login",
    name: "login",
    component: _import("system/login")
  }
];

/**
 * 错误页面
 */
const errorPage = [
  {
    path: "*",
    name: "404",
    component: _import("system/error/404")
  }
];

// 导出需要显示菜单的
export const frameInRoutes = frameIn;

// 重新组织后导出
export default [...frameIn, ...frameOut, ...errorPage];
